package com.bomb.disruptor.db;

import com.alibaba.druid.pool.DruidDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DbUtils {

    public static Connection getConnection() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setUrl(
                "jdbc:mysql://132.122.1.94:19001/aep_dm?useUnicode=true&characterEncoding=utf8&useSSL=false");
        dataSource.setUsername("aep_dm");
        dataSource.setPassword("Aa123456");
        try {
            return dataSource.getConnection(1000 * 60 * 60 * 2);
        } catch (SQLException e) {
            throw new RuntimeException("数据库连接异常");
        }
    }
}
